<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/7/3
  Time: 7:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>table模块快速使用</title>
    <link rel="stylesheet" href="resourse/css/layui.css" media="all">
</head>
<body>

<table id="demo" lay-filter="test"></table>

<script src="resourse/layui.js"></script>
<script>
    layui.use(['table','layer'], function(){
        var table = layui.table;
        var layer=layui.layer;

        //第一个实例
        table.render({
            elem: '#demo'
            ,height: 312
            ,url: 'json/User.json' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'checkbox',type:'checkbox',fixed: 'left'}
                ,{field: 'id', title: 'ID', width:80, sort: true}

                ,{field: 'username', title: '用户名', width:80,edit:Text}
                ,{field: 'sex', title: '性别', width:80, sort: true}
                ,{field: 'city', title: '城市', width:80}
                ,{field: 'sign', title: '签名', width: 177}
                ,{field: 'experience', title: '积分', width: 80, sort: true}
                ,{field: 'score', title: '评分', width: 80, sort: true,totalRow:true}
                ,{field: 'classify', title: '职业', width: 80}
                ,{field: 'wealth', title: '财富', width: 135, sort: true}
            ]]
            ,done:function () {
                layer.alert("表格渲染完毕");
            }

            ,page:true
            ,limit:30
            ,limits:[30,60,90]
            ,text: {
                none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
            }
            ,sort:true
        });

    });
</script>
</body>
</html>
